
// 网格布局类
class TileLayout extends egret.Sprite {
    private myGroup: eui.Group;
    public constructor() {
        super();
        this.myGroup = new eui.Group();
        this.addChild(this.myGroup);
        this.myGroup.layout = new eui.BasicLayout()
        this.myGroup.width = 500;
        this.myGroup.height = 200;
        let outline: egret.Shape = new egret.Shape();
        outline.graphics.lineStyle(3, 0x00ff00);
        outline.graphics.beginFill(0x000000, 0);
        outline.graphics.drawRect(0, 0, 500, 300);
        outline.graphics.endFill();
        this.myGroup.addChild(outline);
        let btn1: eui.Button = new eui.Button();
        btn1.label = 'Button A';
        let btn2: eui.Button = new eui.Button();
        btn2.label = 'Button B';
        let btn3: eui.Button = new eui.Button();
        btn3.label = 'Button C';
        this.myGroup.addChild(btn1);
        this.myGroup.addChild(btn2);
        this.myGroup.addChild(btn3);
        var tLayout: eui.TileLayout = new eui.TileLayout();
        tLayout.horizontalGap = 10;
        tLayout.verticalGap = 10;
        tLayout.columnAlign = eui.ColumnAlign.JUSTIFY_USING_GAP;
        tLayout.rowAlign = eui.RowAlign.JUSTIFY_USING_HEIGHT;
        tLayout.paddingTop = 30;
        tLayout.paddingRight = 30;
        tLayout.paddingLeft = 30;
        tLayout.paddingBottom = 10;
        tLayout.requestedColumnCount = 2;  /// 设置两列显示
        this.myGroup.layout = tLayout;    /// 网格布局
    }

}